package com.sunshine.effctive.chapter02.item3;

/**
 * 使用私有构造方法实现单例模式
 *
 * @author WeiHong
 * @date 2019/11/21 10:08
 */
public class SingleObject {
    private SingleObject() {
    }

    private static final SingleObject SINGLE_OBJECT = new SingleObject();

    public static SingleObject getInstance() {
        return SINGLE_OBJECT;
    }

    public void showMessage() {
        System.out.println("hello world");
    }

}
